Init vulkan#5132
Open
gnavdev28 wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds initial Vulkan DCompute target support (SPIR-V/Vulkan) and wires it into the driver/build configuration for LLVM versions supporting the required SPIR-V/HLSL infrastructure.
Changes:
- Add Vulkan as a DCompute/reflect target and introduce a Vulkan-specific SPIR-V ABI.
- Implement a new Vulkan DCompute backend target (
targetVulkan.cpp) and update driver parsing/help text forvulkan-xy0. - Update build configuration to include new sources and LLVM component dependencies.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/druntime/src/ldc/dcompute.d | Adds Vulkan to ReflectTarget. |
| gen/llvmhelpers.cpp | Adjusts LLVM 23+ getMCAsmInfo() access. |
| gen/dcompute/targetVulkan.cpp | New Vulkan DCompute target implementation. |
| gen/dcompute/target.h | Adds Vulkan target ID + factory declaration (LLVM 23+). |
| gen/abi/targets.h | Declares Vulkan-specific SPIR-V ABI factory. |
| gen/abi/spirv.cpp | Implements Vulkan SPIR-V ABI (calling convention override). |
| driver/dcomputecodegenerator.cpp | Adds vulkan-* target parsing + updates error text. |
| driver/cl_options.cpp | Updates CLI help to mention Vulkan targets. |
| CMakeLists.txt | Adds LLVM frontendhlsl, expands gen source globs, changes MSVC link flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
79
to
85
| error(Loc(), | ||
| "Unrecognised or invalid DCompute targets: the format is ocl-xy0 " | ||
| "for OpenCl x.y and cuda-xy0 for CUDA CC x.y." | ||
| "for OpenCl x.y and cuda-xy0 for CUDA CC x.y, and vulkan-xy0 for Vulkan." | ||
| #if LDC_LLVM_SUPPORTED_TARGET_SPIRV | ||
| " Valid version strings for OpenCl are ocl-{" XSTR(OCL_VALID_VER_INIT) "}." | ||
| " Valid version strings for Vulkan are vulkan-{" XSTR(VULKAN_VALID_VER_INIT) "}." | ||
| #endif |
Comment on lines
+108
to
+109
| llvm::Value *buildIntrinsicCall(IRBuilder<>& builder, llvm::StringRef dbg,llvm::StringRef name, | ||
| llvm::ArrayRef<llvm::Type *> types, llvm::ArrayRef<llvm::Value *> args) { |
Comment on lines
+114
to
+116
| llvm::Function *intrinsic = llvm::Intrinsic::getOrInsertDeclaration(&_ir->module, | ||
| llvm::Intrinsic::lookupIntrinsicID(name), | ||
| types); |
Comment on lines
+102
to
+105
| auto * ArrayType = llvm::ArrayType::get(argType, 0); | ||
| return llvm::TargetExtType::get(ctx, "spirv.VulkanBuffer", | ||
| {ArrayType}, | ||
| {12/*StorageClass*/, 0 /*isWritable*/}); |
Comment on lines
32
to
37
| find_package(LLVM 18.0 REQUIRED | ||
| all-targets analysis asmparser asmprinter bitreader bitwriter codegen core | ||
| debuginfodwarf debuginfomsf debuginfopdb demangle | ||
| debuginfodwarf debuginfomsf debuginfopdb demangle frontendhlsl | ||
| instcombine ipo instrumentation irreader libdriver linker lto mc | ||
| mcdisassembler mcparser objcarcopts object option profiledata scalaropts | ||
| selectiondag support tablegen target transformutils vectorize |
| if(${D_COMPILER_ID} STREQUAL "DigitalMars" AND (MSVC_VERSION GREATER 1800)) # VS 2015+ | ||
| append("-Llegacy_stdio_definitions.lib" DFLAGS_BASE) | ||
| endif() | ||
| append("-L/NODEFAULTLIB:libucrt -L/NODEFAULTLIB:libcmt -L/NODEFAULTLIB:libvcruntime -Lmsvcrt.lib -Lucrt.lib -Lvcruntime.lib -Llegacy_stdio_definitions.lib" DFLAGS_BASE) |
|
|
||
| include (CMakeCPack.cmake) | ||
| include (CPack) | ||
|
|
commit 4314ddcbee8d65049675fb5d33cf71241d3a8bfd Merge: 29789c7 79976be Author: Pham Quang Ha <ha.phamquang.dev@gmail.com> Date: Tue May 12 11:50:28 2026 +0700 Merge remote-tracking branch 'upstream/master' into pr-4958 commit 29789c7 Author: Nicholas Wilson <iamthewilsonator@hotmail.com> Date: Mon Oct 20 15:42:49 2025 +0800 [Dcompute] initial vulkan support
…s and adjust pointer type handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR, I have:
--mdcompute-targetsflag, expanding support fromvulkan 1.0tovulkan 1.6.llvmhelpers.cpp(changed.to->) to resolve a compilation failure.LLVM_LDC_VER >= 2100withLLVM_VERSION_MAJOR >= 23across several files to fix the build with newer LLVM versions.CMakeLists.txtto fix linker/compilation errors.💡 Technical Notes
To make
LLVM_VERSION_MAJOR >= 23work correctly,#include "llvm/Config/llvm-config.h"has been added to the corresponding files where it was missing.